package com.skytech.chatim.sky.task;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.BasicNameValuePair;

public class RestRequestUtil {
    private static String HOST = "http://sky-techcloud.com/im-backend/v1/";
    public static HttpUriRequest getHttpReqeust(AppServerRequest request) {

        try {
            // HttpPost连接对象  
            HttpPost httpRequest = new HttpPost(HOST);  
            // 使用NameValuePair来保存要传递的Post参数  
            List<NameValuePair> params = new ArrayList<NameValuePair>();  
            // 添加要传递的参数  
            params.add(new BasicNameValuePair("par", "HttpClient_android_Post"));  
            // 设置字符集  
            HttpEntity httpentity;
            httpentity = new UrlEncodedFormEntity(params, "gb2312");
            // 请求httpRequest  
            httpRequest.setEntity(httpentity);  
            // 取得默认的HttpClient  
            return httpRequest;
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }   
        return null ;

    }

}
